<template>
  <div id="huishangdiv">
  <el-tabs v-model="activeNameHuishang" @tab-click="tabClick" tab-position="left">
    <el-tab-pane name="HS_HuiYiYiCheng">
      <span slot="label">会议议程 <i class="el-icon-caret-bottom"></i></span>
      <hs-huiyiyicheng :timestamp="subtimestamp" />
    </el-tab-pane>
    <el-tab-pane name="HS_TongBaoQingKuang">
      <span slot="label">通报有关整改措施落实&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>情况和征求意见情况 <i class="el-icon-caret-bottom"></i></span>
      <hs-tongbaoqingkuang :timestamp="subtimestamp" />
    </el-tab-pane>
    <el-tab-pane name="HS_ZiWoPiPing">
      <span slot="label">自我批评 <i class="el-icon-caret-bottom"></i></span>
      <hs-ziwopiping :timestamp="subtimestamp" :leaders="leaders" />
    </el-tab-pane>
    <el-tab-pane name="HS_PiPing">
      <span slot="label">相互批评 <i class="el-icon-caret-bottom"></i></span>
      <hs-piping :timestamp="subtimestamp" :leaders="leaders" />
    </el-tab-pane>
    <el-tab-pane name="HS_ChengYuanBaoGao">
      <span slot="label">班子成员报告情况 <i class="el-icon-caret-bottom"></i></span>
      <hs-chengyuanbaogao :timestamp="subtimestamp" :leaders="leaders" />
    </el-tab-pane>
    <el-tab-pane name="HS_LingDaoCanHui">
      <span slot="label">上级部门和有关督导组（指导组）到会指导情况 <i class="el-icon-caret-bottom"></i></span>
      <hs-lingdaocanhui :timestamp="subtimestamp" />
    </el-tab-pane>
    <el-tab-pane name="HS_ZhiDaoZuDianPing">
      <span slot="label">上级部门和有关督导组（指导组）点评意见 <i class="el-icon-caret-bottom"></i></span>
      <hs-zhidaozudianping :timestamp="subtimestamp" />
    </el-tab-pane>
  </el-tabs>
  </div>
</template>
<script>
import hsHuiyiyicheng from './hsHuiyiyicheng.vue'
import hsTongbaoqingkuang from './hsTongbaoqingkuang.vue'
import hsPiping from './hsPiping.vue'
import hsZiwopiping from './hsZiwopiping.vue'
import hsChengyuanbaogao from './hsChengyuanbaogao.vue'
import hsLingdaocanhui from './hsLingdaocanhui.vue'
import HsZhidaozudianping from './hsZhidaozudianping.vue'
export default {
  components: {
    hsHuiyiyicheng,
    hsZiwopiping,
    hsPiping,
    hsTongbaoqingkuang,
    hsLingdaocanhui,
    hsChengyuanbaogao,
    HsZhidaozudianping
  },
  props: {
    timestamp: '',
    leaders: []
  },
  data () {
    return {
      subtimestamp: null,
      activeNameHuishang: 'HS_HuiYiYiCheng',
      huishangdata: {},
      listLoading: false,
      pipingren: '全部',
      beipipingren: '全部',
      zwpipingren: '全部',
      BanziBaogao: '全部'
    }
  },
  watch: {
    '$store.state.link_hz' (val) {
      this.activeNameHuishang = this.$store.state.link_hz
    }
    // $refs.tree2.getCurrentNode()
  },
  computed: {
    filterList: function () {
      let key = this.pipingren
      let key2 = this.beipipingren
      let oldList = this.huishangdata.HS_PiPing
      if (key === '全部' && key2 === '全部') {
        return oldList
      }
      if (key2 === '全部') {
        return oldList.filter(function (item) {
          return item.BanziPersonName === key
        })
      }
      if (key === '全部') {
        return oldList.filter(function (item) {
          return item.ToBanziPersonName === key2
        })
      }
      return oldList.filter(function (item) {
        return item.ToBanziPersonName === key2 && item.BanziPersonName === key
      })
    },
    zwfilterList: function () {
      let key = this.zwpipingren
      let oldList = this.huishangdata.HS_ZiWoPiPing
      if (key === '全部') {
        return oldList
      }
      return oldList.filter(function (item) {
        return item.BanziPersonName === key
      })
    },
    bgfilterList: function () {
      let key = this.BanziBaogao
      let oldList = this.huishangdata.HS_ChengYuanBaoGao
      if (key === '全部') {
        return oldList
      }
      return oldList.filter(function (item) {
        return item.BanziPersonName === key
      })
    },
    SumBaogaoTiaoshu: function () {
      let s = 0
      this.bgfilterList.forEach(function (val) {
        s += val.Tiaoshu
      })
      return s
    },
    SumZiwopipingWenti: function () {
      let s = 0
      this.zwfilterList.forEach(function (val) {
        s += val.Tiaoshu
      })
      return s
    },
    SumPipingWenti: function () {
      let s = 0
      this.filterList.forEach(function (val) {
        s += val.Tiaoshu
      })
      return s
    }
  },
  methods: {
    tabClick () {
      this.subtimestamp = new Date().getTime()
      var params = {Link_hz: this.activeNameHuishang}
      this.$store.commit('tablink_hz', params)
    }
  },
  mounted () {
    this.tabClick()
  }
}
</script>
<style scoped>
.el-form-item{
  margin:0;
}
</style>
<style>
#tab-HS_TongBaoQingKuang.el-tabs__item{
  height:50px;
  line-height:120%;
  padding-top:10px;
}
#huishangdiv .el-form-item__label{
  font-size:16px;
}
.chuxi{
  color:green;
}
.nochuxi{
  color:red;
}
#huiyiyicheng .el-form-item__content{
  font-size:16px;
}
</style>
